﻿namespace Angle.Application
{
    using System.Reflection;

    using Angle.Core;

    using Castle.MicroKernel.Registration;

    using Skymate.Authorization;
    using Skymate.Modules;

    [DependsOn(typeof(AngleCoreModule))]
    public class AngleApplicationModule : AbpModule
    {
        public override void PreInitialize()
        {
            IocManager.IocContainer.Register(
                Classes.FromThisAssembly()
                .Where(t => t.Name.EndsWith("Service"))
                .WithServiceAllInterfaces()
                .LifestylePerWebRequest());
        }

        /// <inheritdoc/>
        public override void Initialize()
        {
            IocManager.Register<IPermissionChecker, PermissionChecker>();
        }

        public override void PostInitialize()
        {
            FunctionInit.InitSystemFunction(Assembly.GetExecutingAssembly());

        }
    }
}